package com.design_mode;

/**
 * Created by dustaple on 8/4/14.
 */
public class TemplatePattern {
    public static void main(String[] args){
        AbstractTemplate d1 = new Do1();
        AbstractTemplate d2 = new D2();
        d1.templateFun();
        d2.templateFun();

    }
}
abstract class AbstractTemplate{
    public abstract void doSomething1();
    public abstract void doSomething2();
    public void templateFun(){
        doSomething1();
        doSomething2();
    }
}
class Do1 extends AbstractTemplate{
    @Override
    public void doSomething1() {
        System.out.println("Do 11111");
    }

    @Override
    public void doSomething2() {
        System.out.println("Do 22222");
    }
}

class D2 extends AbstractTemplate{
    @Override
    public void doSomething1() {
        System.out.println("44444444");
    }

    @Override
    public void doSomething2() {
        System.out.println("3333333333");
    }
}
